1. Field of the Invention
Methods and apparatuses consistent with the present invention relate to encoding and decoding an image, and more particularly, to encoding and decoding an image, in which a virtual motion vector is assigned to a block which is encoded in intra prediction mode, and when a motion vector of a block which is encoded in inter prediction mode after the intra block is encoded, the virtual motion vector assigned to the intra block is used.
2. Description of the Related Art
When moving pictures are encoded, spatial redundancy and temporal redundancy in the image sequence can be removed, thereby compressing the corresponding data.
In order to remove temporal redundancy, by using another picture, positioned before or after a picture which is currently encoded, as a reference picture, an area of the reference picture similar to an area currently being encoded in the current picture is searched for and a motion vector is generated. Then, motion compensation using the generated motion vector is performed, and the difference (residue) between a prediction image obtained through the motion compensation and the current image is encoded.
In order to decode a current block encoded in inter prediction mode, information on a motion vector indicating the positional difference between the current block and a similar block in the reference picture is required. Accordingly, when encoding is performed, the information on the motion vector is encoded and inserted into a bit stream. However, if information on the motion vector of each block obtained by dividing an image is encoded directly, overhead increases, and the compression ratio may be lowered.
Since motion vectors of neighboring blocks generally have high correlation, a motion vector of a block which is encoded in inter prediction mode (hereinafter referred to as an “inter block”) can be predicted from motion vectors of neighboring blocks. Therefore, according to a related art technology, a motion vector of an inter block is predicted from motion vectors of neighboring inter blocks, and the differential value between the prediction motion vector and the original motion vector is encoded for transmission, thereby compressing information on the motion vector.
FIGS. 1A and 1B are diagrams illustrating a method of predicting a motion vector according to a related art technology.
Referring to FIG. 1A, it is assumed that a block D 11 which is currently being encoded, a block A 12 to the left of the block D 11, a block B 13 above the block D 11, and a block C 14 above and to the right of the block D 11 are all inter blocks and have motion vectors, MVd, MVa, MVb, and MVc, respectively. In this case, a prediction motion vector (MVd′) is calculated from motion vectors (MVa, MVb, and MVc) of neighboring inter blocks A, B, and C 12 through 14. For example, as a prediction motion vector (MVd′) of the current inter block D 11, the median value of the motion vectors (MVa, MVb, and MVc) of the neighboring inter blocks 12 through 14 can be used. Then, the differential motion vector between the original motion vector (MVd) and the prediction motion vector (MVd′) of the current inter block D 11 is calculated and this differential motion vector is encoded as motion information of the current inter block D 11, and transferred to a decoding end.
However, according to the related art technology, when the neighboring blocks of a current inter block are all blocks which are encoded in intra prediction mode (hereinafter referred to as “intra blocks”), the neighboring intra blocks do not have any motion information, and thus the motion vector of the current inter block is encoded directly and transmitted. Referring to FIG. 1B, when neighboring blocks 16 through 18 which are encoded before a current inter block D 15, are all intra blocks, a motion vector (MVd) of the current inter block D 15 is directly encoded and transmitted. According to the related art technology, when intra blocks exist neighboring an inter block, the correlation with neighboring areas cannot be fully used for encoding of a motion vector of the inter block.